package leecode;

/**
 * 功能描述：
 *
 * @Author: lwg
 * @Date: 2021/4/6 17:11
 */
public class demo11 {

    public static void main(String[] args) {
        int[] numbers={2,2,2,1,1};
        System.out.println(minArray(numbers));
    }

    public static int minArray(int[] numbers) {
        int left=0;
        int right=numbers.length-1;
        while(left<right){
            int mid=(left+right)/2;
            if(numbers[mid]>numbers[right]){
                left=mid+1;
            }else if(numbers[mid]<numbers[right]){
                right=mid;
            }else{
                right--;
            }
        }
        return numbers[left];
    }

}

